package com.holyant.goods.dto;

import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.utils.StringUtils;
import com.holyant.goods.enums.GdsSkuPurchasePriceCurTypeEnum;
import com.holyant.goods.enums.QuotMethodEnum;
import com.holyant.goods.enums.QuoteSalesChannel;
import lombok.Data;

import java.util.Objects;


/**
 * @author zgx *
 * @date 2022年06月26日 10:55
 */
@Data
public class GdsGoodsGuidePriceImportDto  extends  PriceImportBase{

    @Excel(name = "渠道类型", prompt = "C2P,POP,B2B-CN,B2B-HK,B2B-MO,KA,WM-C,WM-B",sort = 1)
    private String channelType;
    private Integer channelTypeVal;








    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        GdsGoodsGuidePriceImportDto that = (GdsGoodsGuidePriceImportDto) o;
        return Objects.equals(this.getSkuCode(), that.getSkuCode()) && Objects.equals(this.getCurType(), that.getCurType()) && Objects.equals(this.getQuoteMethod(), that.getQuoteMethod());
    }

    @Override
    public int hashCode() {
        return Objects.hash(this.getSkuCode(), this.getCurType(), this.getQuoteMethod());
    }




    public Integer getChannelTypeVal() {
        if (StringUtils.isEmpty(this.channelType))return null;
        return QuoteSalesChannel.getCodeByName(this.channelType);
    }

    @Override
    public Integer getCurTypeVal() {
        if (StringUtils.isEmpty(super.curType)) return null;
        return GdsSkuPurchasePriceCurTypeEnum.getCodeByName(super.curType);
    }

    @Override
    public Integer getQuoteMethodVal() {
        if (StringUtils.isEmpty(super.quoteMethod)) return null;
        return QuotMethodEnum.getCodeByName(super.quoteMethod);
    }
}
